#!/bin/bash

if [ $# -lt 1 ]
then  
    echo "usage: $0 {start|stop}"
    exit
fi

CLASSPATH_DIR="/opt/taipei-trocaLogin/lib"
ONE_JAR=`ls ${CLASSPATH_DIR}/tools.troca-login*.one-jar.jar`
PID=`ps -eaf | grep troca-login | grep -v grep | awk '{print $2}'`

case $1 in
'start')
	
    if [ "${PID}" != "" ]
    then
	kill ${PID}	
    fi

	/usr/java/default/bin/java -jar $ONE_JAR

    ;;
'stop')

    if [ "${PID}" != "" ]
    then
		echo "killing pid $PID"
        kill ${PID}
    fi

    ;;
*)

    echo "usage: $0 {start|stop}"

    ;;

esac
